package birs.controller.expanditure;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import birs.controller.expanditure.task.XPD002Task;

/**
 * Servlet implementation class XPD002Controller
 */
@WebServlet("/XPD002Controller")
public class XPD002Controller extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public XPD002Controller() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		try{
			XPD002Task xpd002Task = new XPD002Task();
			if(request.getParameter("graphType").equals("line")){
				if(null == request.getParameter("period")){
					xpd002Task.getExpanditureAllIncome(request, response);
				}else if(null == request.getParameter("budgetId")){
					xpd002Task.getFirstDrilldown(request, response);
				}else if(null == request.getParameter("depId")){
					xpd002Task.getSecondDrilldown(request, response);
				}else{
					xpd002Task.getThirdDrilldown(request, response);
				}
			}else if(request.getParameter("graphType").equals("tree")){
				xpd002Task.getTreeGraph(request, response);
			}else if(request.getParameter("graphType").equals("sunburst")){
				xpd002Task.getSunburstGraph(request, response);
			}else if(request.getParameter("graphType").equals("radioBox")){
				xpd002Task.getRadioBox(request, response);
			}
		}catch(Exception e){
			e.printStackTrace();
		}
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

}
